<form id="pagerForm" method="post" action="">
	<input type="hidden" name="pageNum" value="{$pageNum}" />
	<input type="hidden" name="numPerPage" value="{$numPerPage}" />
	<input type="hidden" name="orderField" value="{$orderField}" />
	<input type="hidden" name="orderDirection" value="{$orderDirection}" />
	<input type="hidden" name="keywords" value="{$keywords}" />
	<input type="hidden" name="sfield" value="{$sfield}" />
	<input type="hidden" name="platform" value="SMW01" />
</form>

<div class="pageHeader">
<div class="searchBar">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="" method="post">
		<input type="hidden" name="m" value="{$module_name}" />
		<input type="hidden" name="a" value="{$action_name}" />
	
		<ul class="searchContent">
			<li style="width:210px;">
				<label style="width:60px;">关键字：</label>
				<input type="text" class="autoinput" name="keywords" value="{$keywords}" style="width:120px;"/>
			</li>
			<li style="width:80px;">
			<select name="sfield" class="combox">
				<option value="sn" {if $wherefields == 'sn'} selected="selected" {/if}>订单编号</option>
				<option value="username" {if $wherefields == 'username'} selected="selected" {/if}>用户名</option>
				<option value="mobile" {if $wherefields == 'mobile'} selected="selected" {/if}>手机号码</option>
				<option value="userid" {if $wherefields == 'userid'} selected="selected" {/if}>用户ID</option>
				<option value="consignee" {if $wherefields == 'consignee'} selected="selected" {/if}>姓名</option>
			</select>
			</li>
			<li style="width:160px;">
                 <input name="statetime" class="date"  datefmt="yyyy-MM-dd HH:mm:ss" type="text" value="{$statetime}"/><a class="inputDateButton" href="javascript:;">选择</a>
              </li>
			  <li style="width:160px;">
			     <input name="endtime" class="date"  datefmt="yyyy-MM-dd HH:mm:ss" type="text" value="{$endtime}"/><a class="inputDateButton" href="javascript:;">选择</a>
			</li>
			
			<div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div>
			<div class="buttonActive"><div class="buttonContent"><button type="button" onclick="navTab.reload();">刷新 </button></div></div>
			<div class="buttonActive"><div class="buttonContent">
				<a target="navTab" style="text-decoration:none;" rel="Order_smw_now_ord" href="{:U('Order/smw',array('now_ord'=>1))}">当天审核订单</a></div></div>
			<div class="buttonActive"><div class="buttonContent">
				<a target="navTab" style="text-decoration:none;" rel="Order_smw_separate" href="{:U('Order/smw',array('separate'=>1))}">云采购拆单订单</a></div></div>
		</ul>
		<ul class="searchContent"><li style="width:160px;" >订单状态：

			<select name='status'>
				
				<option value='select' selected='selected'>请选择</option>
				<php>foreach($status as $skey=>$vo){				
				</php>
					<option value='{$skey}' {if $map['status'] == $skey.''}selected='selected' {/if} >{$vo}</option>
				<php>}</php>
			</select>
			</li>
			<li style="width:160px;">付款状态：
			<select name='pay_status'>
				<option value='select'  selected='selected'>请选择</option>
				<php>foreach($pay_status as $pkey=>$vo){</php>
					<option value='{$pkey}' {if $map['pay_status'] == $pkey.''} selected='selected' {/if} >{$vo}</option>
				<php>}</php>
			</select>
			</li>
			<li style="width:160px;">发货状态：
			<select name='shipping_status'>
				<option value='select' selected='selected'>请选择</option>
				<php>foreach($shipping_status as $sskey=>$vo){</php>
					<option value='{$sskey}' {if $map['shipping_status'] == $sskey.''}selected='selected' {/if} >{$vo}</option>
				<php>}</php>
			</select>
			</li></ul>
	
	</form>
	</div>
	<!-- <form rel="pagerForm" onsubmit="return navTabSearch(this);" action="" method="post">
		<div class="buttonActive"><div class="buttonContent"><button type="submit">当天审核订单 </button></div></div>
			<input type="hidden" name="now_ord" value="1"/>
			
	</form> -->
	</div>

<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<!-- <li><a class="icon" href="{:U('Order/show_msg')}&id={sid_dv}" target="dialog" width="580" height="350" rel="Order_show_msg" warn="请选择一个笔订单"><span>查看备注</span></a></li>
			<li><a class="icon" target="selectedTodo" rel="b2bids[]" href="{:U('Order/add_depot')}" title="备货" warn="请选择一个笔订单"><span>备货</span></a></li> -->
			<li><a class="edit selectedDo" href="{:U('Order/out')}" warn="请选择至少选择一个产品" target="_blank" data="b2bids[]" width="600" height="500" rel="dsadsasd"><span>送货单导出</span></a></li>
			<li><a class="edit" onclick="smw_print_new()"><span>出库单</span></a></li>
			<li><a class="edit" onclick="smw_print(0)"><span>批量发货单</span></a></li>		
			<li><a onclick="smw_print(1)" class="edit"><span>发货单合并</span></a></li> 	
			<li><a onclick="smw_psdprint(0)" class="edit"><span>批量快递单</span></a></li> 
			<li><a onclick="smw_psdprint(1)" class="edit"><span>快递单合并</span></a></li> 
			<li><a onclick="order_goods()" class="edit"><span>采购单详情</span></a></li>
			<li><a onclick="order_mergegoods()" class="edit"><span>采购单合并</span></a></li>
					
			<li><a onclick="order_shipping()" class="edit"><span>是否能出库</span></a></li>
			
			<!-- <li><a class="icon" href="javascript:$.printBox('w_list_print')"><span>打印页面</span></a></li> -->
			<!-- <li><a onclick="smw_psdprint_test(0)" class="edit"><span>（批量快递单 - 测试）</span></a></li> -->
		</ul>
	</div>
	<div class="panelBar">
		<ul class="toolBar">
			<li>
			<a class="edit" href="{:U('Order/batchstatus',array('status'=>'1'))}" rel="b2bids[]" target="selectedTodo" title="确实要审核这些订单吗?"><span>批量审核</span></a>
			</li>
			<li>			
			<a class="edit" href="{:U('Order/batchstatus',array('status'=>'5','field'=>'shipping_status'))}" rel="b2bids[]" target="selectedTodo" title="确实要修改状态吗?"><span>批量发货中</span></a>
			</li>
			<li>			
			<a class="edit" href="{:U('Order/batchstatus',array('status'=>'10'))}" rel="b2bids[]" target="selectedTodo" title="确实要修改状态吗?"><span>批量完成</span></a>
			</li>
			<li><a onclick="order_goods_import()" class="edit"><span>采购单详情导出</span></a></li>
			<li><a onclick="order_mergegoods_import()" class="edit"><span>采购单合并导出</span></a></li>
		</ul>
	</div>
	<div id="w_list_print">
	<table class="list" width="98%" targetType="navTab" layoutH="140">
		<thead>
			<tr>
				<th width="22"><input type="checkbox" group="b2bids[]" class="checkboxCtrl"></th>
				<th width="30">编号</th>
				<th width="120">订单号</th>
				<!--<th width="150">出库单</th>-->
				<th width="70">姓名</th>
				<th width="80" >手机</th>
				<th width="40" >用户ID</th>
				<th width="90" >用户名</th>
				<th width="70">总金额</th>
				<th width="140">应收金额<br><span style="color:#F00;">实收金额</span></th>
				<th width="150" >状态</th>
				<th width="150" >创建时间</th>
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
<volist name="list" id="vo">
			<tr target="sid_dv" rel="{$vo['id']}" >
				<td><input name="b2bids[]" value="{$vo['id']}" type="checkbox"></td>
				<td>{$vo['id']}</td>
				<td {if $vo['status'] == -10}style="text-decoration:line-through;"{/if}><a title="{$vo['sn']} 订单查看" target="dialog" width="800" height="650" rel="Order_detail_{$vo['id']}" href="{:U('Order/detail',array('id'=>$vo['id']))}">{$vo['sn']}</a>
				{if $courier_number[$vo['id']]['ext']['pid']['value'] > 0}
				<br/>
				父拆单号：<a title="{$courier_number[$vo['id']]['ext']['pid']['value']} 订单查看" target="dialog" width="800" height="650" rel="Order_detail_{$courier_number[$vo['id']]['ext']['pid']['value']}" href="{:U('Order/detail',array('id'=>$courier_number[$vo['id']]['ext']['pid']['value']))}">{$courier_number[$vo['id']]['ext']['pid']['value']}</a></td>
				{/if}
				<!--<td>{if $depot[$vo['id']]}<a href="{:U('Depot/index',array('oid'=>$vo['id']))}" target="navTab" rel="Order_depotdetail_{$depot[$vo['id']]['code']}" title="{$vo['id']}出库单">{$depot[$vo['id']]['code']}</a>{else}-{/if}</td>-->
				<td>{$vo['consignee']}</td>
				<td>{$vo['mobile']}</td>
				<td>{$vo['userid']}</td>
				<td>{$vo['username']}</td>
				<td>{$vo['amount']/100|number_format=###,2,'.',''}</td>
				<td>{$vo['reality']}<br>
					<span style="color:#F00;">{$vo['spotprice']}</span>
				</td>
				<td>
					<span {if $status[$vo['status']]=='待审核'}style="color:#f00"{/if}>{$status[$vo['status']]}</span> | 
					<span {if $pay_status[$vo['pay_status']]=='未付款'}style="color:#f00"{/if}>{$pay_status[$vo['pay_status']]}</span>
					{if $vo['shipping_status']!=0 && $vo['shipping_status']!=5}
						<br>
					{/if}
					<span {if $vo['shipping_status']=='0'}style="color:#00F"{elseif $vo['shipping_status']==5}style="color:green"{/if}>{$shipping_status[$vo['shipping_status']]}</span>
					{if $vo['shipping_status']!=0 && $vo['shipping_status']!=5}
						：{$courier_number[$vo['id']]['ext']['courier_number']['value']}
					{/if}
					
				</td>
				<td>{if $vo['add_time']=='0'}-{else}{$vo['add_time']|date="Y-m-d H:i:s",###}{/if}</td>
				<td>
					<a title="{$vo['sn']} 查看" target="dialog" width="800" height="650" rel="Order_detail_{$vo['id']}" href="{:U('Order/detail',array('id'=>$vo['id']))}" class="btnInfo">查看</a>
					{if $vo['status']!=-10}
					{if $vo['status']!=-10}
					<a title="{$vo['sn']}标记缺货" target="dialog" width="730" height="450" rel="Order_oos_{$vo['id']}" href="{:U('Order/oos',array('id'=>$vo['id']))}" class="btnEdit">标记缺货</a>
					{/if}
					{if $vo['status'] == 0}
					<a title="{if $vo['status']==0}确认订单{else}订单已经确认{/if}" target="ajaxTodo" href="{:U('Order/status',array('id'=>$vo['id'],'status'=>'1'))}" {if $vo['status']==0}class="btnsk"{else}class="btnyqr"{/if}>确认</a>
					{/if}
					{if $vo['shipping_status'] != 1}
					<a title="{$vo['sn']} 发货" target="dialog" width="500" height="200" rel="Order_sipping_{$vo['id']}" href="{:U('Order/sipping',array('id'=>$vo['id']))}" class="btnfh">发货</a>
					{/if}
					<a target="_blank" href="{:U('Print/smw_print',array('id'=>$vo['id']))}" title="打印出库单" class="btndy2">出库单</a>
					<a target="_blank" href="{:U('Print/smw_psdprint',array('id'=>$vo['id']))}" title="打印快递单" class="btndy">快递单</a>
					
					<!-- <a title="{$vo['sn']} 订单询价" target="navTab" rel="Order_suppliers_{$vo['id']}" href="{:U('Order/suppliers',array('ids'=>$vo['id']))}" class="btnLook">订单询价</a> -->
					{if $vo['status']!=10 && $vo['shipping_status'] != 1}
					<a title="{if $vo['status']!=-10}订单取消，只修改订单状态，未退返金额{else}已取消{/if}" target="ajaxTodo" href="{:U('Order/cancel',array('id'=>$vo['id']))}" {if $vo['status']!=-10}class="btnDel"{else}class="btnqx"{/if}>取消</a>
					{/if}
					{/if}
					{if $vo['status'] == -10 && $vo['pay_status'] != 3 && $vo['pay_status'] != 4 }
						<a href="{:U('Refund/edit',array('sn'=>$vo['sn'],'userid'=>$vo['userid'],'uname'=>$vo['username'],'prices'=>$vo['reality_value'],'orderid'=>$vo['id'],'key'=>'ordref'))}" class='btntk' target="dialog" width="600" height="500" title="申请退款"><span>申请退款</span></a>
					{/if}
					{if $vo['shipping_status'] == 1 && $vo['shipping_time'] < (time() - 604800) && $vo['status'] != 10}
						<!-- <a title="确实要完成这个订单?" href="{:U('Order/confirm_status',array('id'=>$vo['id']))}" target="ajaxTodo" title="确定要确定吗?" class="btnSelect">确定订单完成</a> -->
						<a href="{:U('Order/status',array('status'=>10,'id'=>$vo['id']))}" title="订单完成" class='btnSelect' target="ajaxTodo" width="600" height="500"><span>订单完成</span></a>
					{/if}
					{if $vo['status']!=-10}
					<!-- begin bv by tb 单次采购蛮 1.5w 赠送 100BV -->
					{if $courier_number[$vo['id']]['ext']['givebv']['value']}
				
					<a href="{:U('Refund/edit',array('sn'=>$vo['sn'],'userid'=>$vo['userid'],'uname'=>$vo['username'],'prices'=>10000,'orderid'=>$vo['id'],'key'=>'givebv'))}" class="btnbv" target="dialog" width="600" height="500" title="赠送BV">送BV</a>
					{/if}
					<a title="{$vo['sn']}拆单" target="dialog" width="730" height="450" rel="Order_separate_{$vo['id']}" href="{:U('Order/separate',array('id'=>$vo['id']))}" class="">拆单</a>
					<a title="{$vo['sn']}换产品" target="dialog" width="1030" height="450" rel="Order_ogoods_{$vo['id']}" href="{:U('Order/ogoods',array('id'=>$vo['id']))}" class="">换产品</a>
					<a title="标记补发" target="ajaxTodo" rel="Order_reissue_{$vo['id']}" href="{:U('Order/reissue',array('id'=>$vo['id']))}" class="">标记补发</a>
					{/if}
					<!-- end bv by tb 单次采购蛮 1.5w 赠送 100BV -->
					<!-- <a title="{$vo['sn']} 添加串码" target="dialog" width="800" height="650" rel="Order_detail_{$vo['id']}" href="{:U('Order/imei',array('id'=>$vo['id']))}" class="btnAdd">查看</a> -->
					<!-- <a target="_blank" href="{:U('Print/smw_psdprint_test',array('id'=>$vo['id']))}" title="测试快递单" class="">（测试 - 快递单）</a>-->
				</td>
			</tr>
</volist>
		</tbody>
	</table>
	</div>
<include file="Index:pages" />
</div>
<script>
function smw_print(data){	  
	var ids =document.getElementsByName("b2bids[]");
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }      
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=smw_print&ids="+oids+"&merge="+data);
	}
}
function smw_print_new(){	  
	var ids =document.getElementsByName("b2bids[]");
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }      
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=smw_print_new&ids="+oids);
	}
}

function smw_psdprint(data){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=smw_psdprint&ids="+oids+"&merge="+data);
	}
}

function smw_psdprint_test(data){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Print&a=smw_psdprint_test&ids="+oids+"&merge="+data);
	}
}

function order_goods(){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Order&a=order_goods&ids="+oids);
	}
}
function order_mergegoods(){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Order&a=order_mergegoods&ids="+oids);
	}
}
function order_shipping(){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Order&a=order_shipping&ids="+oids);
	}
}
function order_goods_import(){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Order&a=order_goods_import&ids="+oids);
	}
}
function order_mergegoods_import(){
	var ids =document.getElementsByName("b2bids[]");	
	var oids="";
	for(var i=0;i<ids.length;i++){
         if(ids[i].checked){
        	 if(oids!=""){
        		 oids+=","+ids[i].value;
        	 }else{
        		 oids+=ids[i].value;
        	 }
     	 } 
    }     
	if(oids==""){
		alert("请选择一个订单");
	}else{
		window.open("index.php?m=Order&a=order_mergegoods_import&ids="+oids);
	}
}
</script>